package cn.gok.homework;

/**
 * @Author: zhengyx
 * @Date: 2022/7/5 20:24
 * @Version 1.0
 */
/*
1,1,2,3,5,8
*/

public class Demo {
    public static void main(String[] args) {
//        int a1=1,a2=1,a,f,n=6;
//        for(int i=0;i<n;i++){
//            f=a2;
//            a2=a1+a2;
//            a1=f;
//            System.out.println(a2);
//
//        }
        System.out.println(feibo(68));
        System.out.println(f(68));
    }



    public static int feibo(int n){
        int[] ints = new int[n];
        ints[0] = 1;
        ints[1] = 1;
        for (int i = 2; i < n ; i++) {
            ints[i] = ints[i-1] + ints[i-2];
        }

        return ints[n-1];
    }

    public static int f(int x){
        if(x==1||x==2){
            return 1;
        }else {
            return f(x-1)+f(x-2);
        }
    }

}
